You are here: About application links > Understanding the AutoCAD links > Configuring title block synchronization > Synchronizing multiple blocks per drawing

Synchronizing multiple blocks per drawing

The Meridian Enterprise AutoCAD link assumes that each drawing contains one title block or multiple identical title blocks in the same layout. AutoCAD drawings that contain multiple title blocks with different attribute values in each layout require special configuration. In both cases, the attribute values of the blocks will be the same within the same layout.

The AutoCAD link accommodates this by supporting two user-defined VBScript functions, one to read the attribute values of specified title blocks and one to write the attribute values of specified title blocks.

The implementation of these functions is the responsibility of the customer. The functions can have any valid names. The link simply calls the functions at the appropriate moment during standard title block synchronization. The functions should contain all of the logic necessary to read and write the appropriate attribute values in the drawings, such as with Visual Basic for Applications.

Both of the functions will be called by the AutoCAD link with one parameter. The parameter is an array of arrays that each contain strings in the following order:

  1. Attribute name
  2. Title block name
  3. Layout name
  4. Attribute value

Recommended logic for both functions to iterate through the parameter array is shown in the following example.

Function UpdateFromDoc(PropList)
   On Error Resume Next
   
   If IsArray(PropList) Then
      iSize = UBound(PropList)
      For i = 0 To iSize
         CurProp = PropList(i)
         If IsArray(CurProp) Then
            If UBound(CurProp) = 3 Then
               'Read the corresponding attribute value or write
               'the corresponding vault property here.
            End If
         End If
      Next
   End If

   UpdateFromDoc = True
End Function

The title block reading function may return any value, the value is not checked by the link.

If the return value of the title block writing function is True, the link will check all new values provided by the function and will set the corresponding attributes. To set an empty value, use an empty string (""). When the function is called, all parameter elements are Empty.

To configure synchronization for multiple blocks per drawing:

  1. Implement the title block reading and title block writing functions in the vault's VBScript block. For more information on the Meridian Enterprise VBScript API and modifying a vault's event script block, see the BlueCielo Meridian Enterprise VBScript API Reference.
  2. Modify the AutoCAD link settings as described in Configuring title block synchronization.
    1. In the [Settings] section, specify the name of the title block reading function in the UpdatePropertiesFromDocument setting.
    2. In the [Settings] section, specify the name of the title block writing function in the UpdatePropertiesToDocument setting.
    3. In the section for each block, specify the keyword UseScriptFunction for each attribute that should use the script functions. Specify read/write flags the same as if a property name was specified, if necessary.

Following is an example of the preceding settings.

[Settings]
UpdatePropertiesToDocument=UpdateToDoc
UpdatePropertiesFromDocument=UpdateFromDoc
[BLOCK_1]
PROJECT_NM=Custom.Projectname
FIELD1=UseScriptFunction
FIELD2=UseScriptFunction,WO
FIELD3=UseScriptFunction,RO

In this example, the script function UpdateToDoc will be called to update the attributes FIELD1 and FIELD2 for all instances of the block BLOCK_1. The script function UpdateFromDoc will be called to update the properties that correspond to attributes FIELD1 and FIELD3 for all instances of the block BLOCK_1.

Related concepts

Understanding the AutoCAD links


www.bluecieloecm.com